package com.ninetaildemonfox.zdl.socialproject.utils.dialog;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.ninetaildemonfox.zdl.socialproject.base.BaseActivity;
import com.ninetaildemonfox.zdl.socialproject.R;
import com.ninetaildemonfox.zdl.socialproject.mvp.presenter.CommentPresenter;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @author NineTailDemonFox
 * @date 2019/7/24 15:25
 * 功能描述： 发布对话框
 * 联系方式：1037438704@qq.com
 */
public class CommentActivity extends BaseActivity {
    private CommentPresenter presenter;
    @BindView(R.id.rl_view)
    RelativeLayout rlView;
    @BindView(R.id.edit_content)
    EditText editContent;
    @BindView(R.id.text_send_out)
    TextView textSendOut;
    private String id;

    @Override
    protected int getLayoutResource() {
        return R.layout.activity_comment;
    }

    @Override
    protected void onInitialization(Bundle bundle) {
        id = getIntent().getExtras().getString("id");
        presenter = new CommentPresenter(me, this);
    }

    @OnClick({R.id.rl_view, R.id.text_send_out})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.rl_view:
                finish();
                break;
            case R.id.text_send_out:
                presenter.addOrderComment(token, id, editContent.getText().toString());
                break;
            default:
        }
    }

    public static void start(Context me, String id) {
        Bundle bundle = new Bundle();
        bundle.putString("id", id);
        Intent intent = new Intent(me, CommentActivity.class);
        intent.putExtras(bundle);
        me.startActivity(intent);
    }
}
